﻿@{
    ViewBag.Title = "AgentPriceSet";
}

@section scripts
{
    <script src="@Url.Content("~/Scripts/shared/share.js")" type="text/javascript"></script> 
    <script src="@Url.Content("~/Scripts/shared/shown.js")" type="text/javascript"></script>
    <link href="~/Scripts/miniui/themes/default/medium-mode.css" rel="stylesheet" type="text/css" />      
}
<div class="mini-toolbar" style="padding:2px;border-top:0;border-left:0;border-right:0;">                
    <table style="width:100%;">
        <tr>
            <td style="width:100%;">
                <span class="separator"></span>
                <a class="mini-button" iconCls="icon-ok" onclick="saveInfo" plain="true">保存</a>
                <span class="separator"></span>
                    <a class="mini-button" iconCls="icon-close" onclick="CloseWindow" plain="true">关闭</a>
            </td>
        </tr>
    </table>                
</div>
    <div class="mini-fit">
        <div id="datagrid1" class="mini-datagrid" style="width:100%;height:370px;" idField="FItemID" 
            allowCellSelect="true" allowCellEdit="true" showColumnsMenu="true"
            borderStyle="border:0;" url="../Corp/GetAgentPrice" fitColumns="false"  
            sortMode="client" onlyCheckSelection ="true" showPager="false">
            <div property="columns">
                <div type="checkcolumn"></div>      
                <div type="indexcolumn" width="70" headerAlign="center" >序号</div>        
                <div field="FName" width="200" allowSort="true" headerAlign="center" >软件模块</div> 
                <div field="FSalesPrice" width="130" numberFormat="#,0.00" headerAlign="center" align="right" allowSort="true">零售价
                     <input property="editor" class="mini-spinner PopInput" minValue="0" maxValue="99999999" value="0" style="width:100%;"/>
                </div>   
            </div>
        </div>  
    </div>
<script>
    mini.parse();

    function FormShown() {
        LoadPriceList();
    }

    function SetInfoData(data) {
    }

    function LoadPriceList() {
            var json = "[{";
            json = json + "'FSystemAppID':'" + parent.window.getSystemAppID() +"',";
            json = json + "}]";
            var grid = mini.get("datagrid1");
            grid.load({ mjson: json });
    }

    function saveInfo() {
            var data = mini.get("datagrid1").getData();
            var jsondata = mini.encode(data);
            var json = '[{"data":' + jsondata + ',"FSystemAppID":"' + parent.window.getSystemAppID() + '"}]';
            $.post("SaveAgentPrice", { mjson: json }, function (data) {
                var ret = mini.decode(data);
                if (ret.status == 1) {
                    mini.showTips({ content: ret.msg, state: "success", x: "center", y: "top", timeout: 3000 }, function () {
                        mini.alert("保存完成");
                    });
                    NewInfo();
                    if (mini.getbyName("ck1").getChecked() == false)
                        CloseWindow();
                }
                else {
                    mini.alert("异常：" + ret.error);
                }
            });
    }
</script>